import { createRouter, createWebHashHistory } from 'vue-router'


const routes = [
  {
    path: '/',
    name: 'layout',
    component: () => import( '../views/layout.vue'),
    redirect:'/home',
    children:[
      {
        path: 'home',
        component: () => import( '../views/home/index.vue'),
      },
      {
        path:'cagegory/:id',
        component: () => import( '@/views/category/index'),

      },
      // product
      {
        path:'product/:id',
        component: () => import( '@/views/product/index'),
      },
      {
        path:'car',
        component: () => import( '@/views/card/index'),

      },
      {
        path:'cagegory/sub/:id',
        component: () => import( '@/views/category/sub/sub'),

      },
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import( '../views/login/index.vue'),
  }
  
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
